<?php
/*
 * Created on Aug 19, 2009
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

 class ALink
 {
	private $storyId =null;
	private $storyTitle =null;
	private $linkType =null;
	private $dated = null;
	private $href = null;



    public function __construct($storyId, $storyTitle, $linkType, $dated, $href)
    {

		$this->storyId = $storyId;
		$this->storyTitle = $storyTitle;
		$this->linkType = $linkType;
		$this->dated = $dated;
		$this->href = $href;


    }




	public function getHref()
	{
		return $this->href;
	}



	public function getStoryId()
	{
		return $this->storyId;
	}

	public function getStoryTitle()
	{
		return $this->storyTitle;
	}


	public function getlinkType()
	{
		return $this->linkType;
	}



	public function getDated()
	{
		return $this->dated;
	}

	public function getYear()
	{
		return substr($this->dated,0,4);
	}

	public function getMonthNumber()
	{
		return  substr($this->dated,5,2);
	}

	public function getMonth()
	{
		$month = substr($this->dated,5,2);

		switch ($month)
		{    // switches replace multiple if statements and are neater but either way works
		    case 01:            // if the variable matches the value after case then the next line(s) is/are executed
		        $monthword="January";
		        break;        // break stops execution and jumps to the end (otherwise all case statements will be checked which is slower)
		    case 02:
		        $monthword="February";
		        break;
		    case 3:
		        $monthword="March";
		        break;
		    case 4:
		        $monthword="April";
		        break;
		    case 5:
		        $monthword="May";
		        break;
		    case 6:
		        $monthword="June";
		        break;
		    case 7:
		        $monthword="July";
		        break;
		    case 8:
		        $monthword="August";
		        break;
		    case 9:
		        $monthword="September";
		        break;
		    case 10:
		        $monthword="October";
		        break;
		    case 11:
		        $monthword="November";
		        break;
		    case 12:
		        $monthword="December";
		        break;
		    default:        // this is done if none of the others match
		        $monthword="error";
		}
//	echo $monthword;
		return $monthword;
	}


 }
?>
